package com.API.beans;


import com.API.dal.entities.Incomes;
import com.API.dal.entities.Objects;
import com.API.dal.providers.CustomerProvider;
import com.API.dal.providers.IncomeProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Scope("request")
public class IncomeBean {

    @Autowired
    CustomerProvider customerProvider;
    @Autowired
    IncomeProvider incomeProvider;

    Incomes income;
    List<Incomes> incomesList;
    Incomes selectedIncome;

    public Incomes getIncome() {
        return income;
    }

    public void setIncome(Incomes income) {
        this.income = income;
    }

    public List<Incomes> getIncomesList() {
        return incomesList;
    }

    public Incomes getSelectedIncome() {
        return selectedIncome;
    }

    public void setSelectedIncome(Incomes selectedIncome) {
        this.selectedIncome = selectedIncome;
    }

    public String getIncomeCustomer(int income_id){
        Objects income = incomeProvider.getCustomer(income_id);
        return income.getName();
    }
}
